﻿using Budget.Model;
using Budget.Service;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace Budget.API.Controllers
{
    [ApiController]
    [Route("[controller]")]
    /// <summary>
    /// 工程管理
    /// </summary>
    public class ProjectController : ControllerBase
    {
        readonly ProjectService projectService = new ProjectService();

        /// <summary>
        /// 创建工程
        /// </summary>
       [HttpPost]
        public void Insert(Project project)
        {
            projectService.Insert(project);
        }

        /// <summary>
        /// 获取列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<Project> GetList(string adminId,int pageIndex, int pageSize)
        {
            return projectService.GetProjects(adminId, pageIndex, pageSize);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        [HttpDelete]
        public void Delete(string id)
        {
            projectService.Datele(id);
        }

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="project"></param>
        [HttpPost]
        public void Update(Project project)
        {
            projectService.Update(project);
        }
        
    }
}
